package org.jeecg.modules.demo.main.service.impl;

import org.jeecg.modules.demo.main.entity.ErpCesOrderMain;
import org.jeecg.modules.demo.main.entity.ErpCesOrderGoods;
import org.jeecg.modules.demo.main.entity.ErpCesOrderCustomer;
import org.jeecg.modules.demo.main.mapper.ErpCesOrderGoodsMapper;
import org.jeecg.modules.demo.main.mapper.ErpCesOrderCustomerMapper;
import org.jeecg.modules.demo.main.mapper.ErpCesOrderMainMapper;
import org.jeecg.modules.demo.main.service.IErpCesOrderMainService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: Erp商城订单表
 * @Author: jeecg-boot
 * @Date:   2022-01-21
 * @Version: V1.0
 */
@Service
public class ErpCesOrderMainServiceImpl extends ServiceImpl<ErpCesOrderMainMapper, ErpCesOrderMain> implements IErpCesOrderMainService {

	@Autowired
	private ErpCesOrderMainMapper erpCesOrderMainMapper;
	@Autowired
	private ErpCesOrderGoodsMapper erpCesOrderGoodsMapper;
	@Autowired
	private ErpCesOrderCustomerMapper erpCesOrderCustomerMapper;
	
	@Override
	@Transactional
	public void delMain(String id) {
		erpCesOrderGoodsMapper.deleteByMainId(id);
		erpCesOrderCustomerMapper.deleteByMainId(id);
		erpCesOrderMainMapper.deleteById(id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			erpCesOrderGoodsMapper.deleteByMainId(id.toString());
			erpCesOrderCustomerMapper.deleteByMainId(id.toString());
			erpCesOrderMainMapper.deleteById(id);
		}
	}
	
}
